{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3.7.7 64-bit ('base': conda)",
   "metadata": {
    "interpreter": {
     "hash": "e04390b745d7540077d5afc7ea9b350ff3db0922faee759c3145cf85f5ee4c0c"
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "调用方法\n"
     ]
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'25'"
      ]
     },
     "metadata": {},
     "execution_count": 8
    }
   ],
   "source": [
    "class people():  #定义类\n",
    "    def __init__(self, name, sex, age):  #属性初始化\n",
    "        self.name = name\n",
    "        self.sex = sex\n",
    "        self.age = age\n",
    "    \n",
    "    def change_sex(self):  #方法\n",
    "        print(\"调用方法\")\n",
    "\n",
    "glx = people(\"glx\",\"male\",\"25\")  #实例化，生成一个对象，属性要全\n",
    "glx.change_sex() # 调用方法\n",
    "glx.age # 获取属性\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}